package com.cloud.edu.sys.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.cloud.edu.contants.Constant;
import com.cloud.edu.sys.model.User;

/**
 * Controller公共组件
 * 
 */
public abstract class AbstractController {
	
	protected Logger logger = LoggerFactory.getLogger(getClass());
	
	protected User getUser() {
		Session session = SecurityUtils.getSubject().getSession();
		return (User) session.getAttribute(Constant.USERSESSION);
	}

	protected String getUserId() {
		return getUser().getId();
	}
}
